<?php

namespace app\controller;

use app\model\PublishingHouseModel;
use think\annotation\route;
use think\response\Json;

class PublishingHouseController
{
    /**
     * @route ("insertPublishingHouses")
     * @param $publishingHouses
     * @param PublishingHouseModel $publishingHouseModel
     * @return int
     */
    public function insertPublishingHouses($publishingHouses, PublishingHouseModel $publishingHouseModel): int
    {
        return $publishingHouseModel->insertPublishingHouses($publishingHouses);
    }

    /**
     * @route ("deletePublishingHouses")
     * @param $ids
     * @param PublishingHouseModel $publishingHouseModel
     * @return Json
     */
    public function deletePublishingHouses($ids, PublishingHouseModel $publishingHouseModel): Json
    {
        return json(["result"=>$publishingHouseModel->deletePublishingHouses($ids)]);
    }

    /**
     * @route ("getAllPublishingHouses")
     * @param PublishingHouseModel $publishingHouseModel
     * @return PublishingHouseModel[]|\think\Collection
     */
    public function getAllPublishingHouses(PublishingHouseModel $publishingHouseModel)
    {
        return $publishingHouseModel->getAllPublishingHouses();
    }

    /**
     * @route ("updatePublishingHouses")
     * @param $publishingHouses
     * @param PublishingHouseModel $publishingHouseModel
     * @return void
     */
    public function updatePublishingHouses($publishingHouses, PublishingHouseModel $publishingHouseModel)
    {
        $publishingHouseModel->updatePublishingHouses($publishingHouses);
        return json(["result"=>true]);
    }
}